﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/Admin-One-Column.master" AutoEventWireup="true" CodeBehind="KhachHang.aspx.cs" Inherits="BookStore.admin.KhachHang" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="BreadcrumbsContent" runat="server">
<h1>Chi Tiết Thông Tin Khách Hàng</h1>
<br />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainColumnContent" runat="server">
<div id="admin-table">
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
        DataKeyNames="MaKhachHang" DataSourceID="SqlDataSource1" Height="50px" 
        Width="248px" CellPadding="4" ForeColor="#333333" GridLines="None">
        <AlternatingRowStyle BackColor="White" />
        <CommandRowStyle BackColor="#C5BBAF" Font-Bold="True" />
        <EditRowStyle BackColor="#7C6F57" />
        <FieldHeaderStyle BackColor="#D0D0D0" Font-Bold="True" />
        <Fields>
            <asp:BoundField DataField="MaKhachHang" HeaderText="Mã Khách Hàng" 
                InsertVisible="False" ReadOnly="True" SortExpression="MaKhachHang" >
           
            <ItemStyle Width="100px" />
            </asp:BoundField>
           
            <asp:BoundField DataField="TenKhachHang" HeaderText="Tên Khách Hàng" 
                SortExpression="TenKhachHang" >
                <ItemStyle Width="100px" />
            </asp:BoundField>

            <asp:BoundField DataField="DiaChi" HeaderText="Địa Chỉ" 
                SortExpression="DiaChi" >
                <ItemStyle Width="100px" />
            </asp:BoundField>

            <asp:BoundField DataField="DienThoai" HeaderText="Điện Thoại" 
                SortExpression="DienThoai">
                <ItemStyle Width="100px" />
            </asp:BoundField>

            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" >
                <ItemStyle Width="100px" />
            </asp:BoundField>

            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ButtonType="Image" CancelImageUrl="~/images/cross.png" 
                DeleteImageUrl="~/images/cross.png" EditImageUrl="~/images/pencil.png" 
                UpdateImageUrl="~/images/check.png" NewImageUrl="~/images/i_msg-note.gif" 
                ShowInsertButton="True" />
        </Fields>
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#E3EAEB" />
    </asp:DetailsView>

</div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        DeleteCommand="DELETE FROM [KhachHang] WHERE [MaKhachHang] = @MaKhachHang" 
        InsertCommand="INSERT INTO [KhachHang] ([UserID], [TenKhachHang], [DiaChi], [DienThoai], [Email]) VALUES (@UserID, @TenKhachHang, @DiaChi, @DienThoai, @Email)" 
        ProviderName="<%$ ConnectionStrings:ApplicationServices.ProviderName %>" 
        SelectCommand="SELECT [MaKhachHang], [UserID], [TenKhachHang], [DiaChi], [DienThoai], [Email] FROM [KhachHang] WHERE MaKhachHang = @MaKhachHang" 
        UpdateCommand="UPDATE [KhachHang] SET [UserID] = @UserID, [TenKhachHang] = @TenKhachHang, [DiaChi] = @DiaChi, [DienThoai] = @DienThoai, [Email] = @Email WHERE [MaKhachHang] = @MaKhachHang">
        <SelectParameters>
            <asp:QueryStringParameter Name="MaKhachHang"
                QueryStringField="MaKhachHang" Type="Int32" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="MaKhachHang" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="UserID" Type="Object" />
            <asp:Parameter Name="TenKhachHang" Type="String" />
            <asp:Parameter Name="DiaChi" Type="String" />
            <asp:Parameter Name="DienThoai" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="UserID" Type="Object" />
            <asp:Parameter Name="TenKhachHang" Type="String" />
            <asp:Parameter Name="DiaChi" Type="String" />
            <asp:Parameter Name="DienThoai" Type="String" />
            <asp:Parameter Name="Email" Type="String" />
            <asp:Parameter Name="MaKhachHang" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
